﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using NWN.GDY.Service.Core;
using NWN.GDY.Service.Entity;
using NWN.GDY.Web.uc;

namespace NWN.GDY.Web
{
    public partial class Room : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            List<NWN.GDY.Service.Entity.Room> Tables = new GDYEngine().GetALLTables();
            dtlTables.DataSource = Tables;
            dtlTables.DataBind();
        }

        protected void dtlTables_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            NWN.GDY.Service.Entity.Room table= e.Item.DataItem as NWN.GDY.Service.Entity.Room;
            foreach (Seat st in table.Seats)
            {
                ucRoomSeat ucrs = e.Item.FindControl("ucSeat" + st.SeatID.ToString()) as ucRoomSeat;
                if (ucrs != null)
                {
                    ucrs.UserSeat = st;
                    ucrs.TableGUID = table.RoomGUID;
                    ucrs.Processing = table.GameProcessing;
                    ucrs.BindInfo();
                }
            }
        }
    }
}
